{% set pypi_name = 'neutron' %}
{% set source = fetch_source('https://tarballs.openstack.org/neutron/neutron-master.tar.gz') %}
{% set upstream_version = upstream_version() %}
{% set rpm_release = '1' %}
%global with_doc 1
%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           {{ py2name() }}
Epoch:          {{ epoch('neutron') }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack Networking Service (Neutron)
License:        {{ license('Apache-2.0') }}
URL:            https://docs.openstack.org/neutron
Source0:        {{ source|basename }}
Source1:        openstack-neutron.logrotate
Source2:        openstack-neutron.sudoers
Source3:        openstack-neutron-server.service
Source4:        openstack-neutron-linuxbridge-agent.service
Source5:        openstack-neutron-openvswitch-agent.service
Source6:        openstack-neutron-dhcp-agent.service
Source7:        openstack-neutron-l3-agent.service
Source8:        openstack-neutron-metadata-agent.service
Source9:        openstack-neutron-macvtap-agent.service
Source10:       openstack-neutron-metering-agent.service
Source11:       openstack-neutron-sriov-nic-agent.service
Source12:       openstack-neutron-rpc-server.service
Source13:       openstack-neutron-netns-cleanup.service
Source14:       openstack-neutron-linuxbridge-cleanup.service
Source15:       openstack-neutron-ovs-cleanup.service
Source16:       openstack-neutron-ovn-metadata-agent.service
Source20:       openstack-neutron-server.defaultconf
Source21:       openstack-neutron.tmpfiles
Source22:       openstack-neutron-l2-agents.modules
Source23:       openstack-neutron-l2-agents.sysctl
Source90:       openstack-neutron-server.README.config
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('WebTest') }}
BuildRequires:  {{ py3('ddt') }}
BuildRequires:  {{ py3('python-designateclient') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('futurist') }}
BuildRequires:  {{ py3('httplib2') }}
BuildRequires:  {{ py3('python-ironicclient') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('keystonemiddleware') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('neutron-lib') }}
BuildRequires:  {{ py3('python-neutronclient') }}
BuildRequires:  {{ py3('python-novaclient') }}
BuildRequires:  {{ py3('os-ken') }}
BuildRequires:  {{ py3('os-vif') }}
BuildRequires:  {{ py3('os-xenapi') }}
BuildRequires:  {{ py3('oslo.cache') }}
BuildRequires:  {{ py3('oslo.privsep') }}
BuildRequires:  {{ py3('oslo.reports') }}
BuildRequires:  {{ py3('oslo.rootwrap') }}
BuildRequires:  {{ py3('oslo.upgradecheck') }}
BuildRequires:  {{ py3('oslo.versionedobjects') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('osprofiler') }}
BuildRequires:  {{ py3('ovs') }}
BuildRequires:  {{ py3('ovsdbapp') }}
BuildRequires:  {{ py3('pecan') }}
BuildRequires:  {{ py3('pyroute2') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('reno') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('tenacity') }}
BuildRequires:  {{ py3('tooz') }}
BuildRequires:  sudo
Requires:       python3-{{ pypi_name }} = %{epoch}:%{version}-%{release}
Requires:       sudo
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(preun): systemd
%endif

%description
Neutron is a virtual network service for Openstack.

This package contains the base supporting files.

%package -n python3-{{ pypi_name }}
Summary:        Neutron Python libraries
Group:          Applications/System
Requires:       {{ py3('Jinja2') }}
Requires:       {{ py3('Paste') }}
Requires:       {{ py3('PasteDeploy') }}
Requires:       {{ py3('Routes') }}
Requires:       {{ py3('SQLAlchemy') }}
Requires:       {{ py3('WebOb') }}
Requires:       {{ py3('alembic') }}
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('decorator') }}
Requires:       {{ py3('python-designateclient') }}
Requires:       {{ py3('eventlet') }}
Requires:       {{ py3('futurist') }}
Requires:       {{ py3('httplib2') }}
Requires:       {{ py3('python-ironicclient') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('keystonemiddleware') }}
Requires:       {{ py3('netaddr') }}
Requires:       {{ py3('netifaces') }}
Requires:       {{ py3('neutron-lib') }}
Requires:       {{ py3('python-neutronclient') }}
Requires:       {{ py3('python-novaclient') }}
Requires:       {{ py3('os-ken') }}
Requires:       {{ py3('os-vif') }}
Requires:       {{ py3('os-xenapi') }}
Requires:       {{ py3('oslo.cache') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.context') }}
Requires:       {{ py3('oslo.db') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.messaging') }}
Requires:       {{ py3('oslo.middleware') }}
Requires:       {{ py3('oslo.policy') }}
Requires:       {{ py3('oslo.privsep') }}
Requires:       {{ py3('oslo.reports') }}
Requires:       {{ py3('oslo.rootwrap') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.service') }}
Requires:       {{ py3('oslo.upgradecheck') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('oslo.versionedobjects') }}
Requires:       {{ py3('osprofiler') }}
Requires:       {{ py3('ovs') }}
Requires:       {{ py3('ovsdbapp') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('pecan') }}
Requires:       {{ py3('psutil') }}
Requires:       {{ py3('pyroute2') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}
Requires:       {{ py3('tenacity') }}
Requires:       {{ py3('tooz') }}

%description -n   python3-{{ pypi_name }}
Neutron is a virtual network service for Openstack.

This package contains the Neutron Python library.

%package server
Summary:        Neutron API server
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description server
Neutron is a virtual network service for Openstack.

This package contains the Neutron API server.

%package dhcp-agent
Summary:        Neutron DHCP Agent
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description dhcp-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron DHCP Agent.

%package l3-agent
Summary:        Neutron l3 Agent
Requires:       conntrack-tools
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description l3-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron l3 Agent.

%package linuxbridge-agent
Summary:        Neutron Linuxbridge agent
Requires:       /sbin/modprobe
Requires:       bridge-utils
Requires:       conntrack-tools
Requires:       ebtables
Requires:       ipset
Requires:       iptables
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}
Provides:       {{ py2name('neutron') }}-l2-agent = %{epoch}:%{version}-%{release}

%description linuxbridge-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron agent that implements virtual
networks using VLAN or VXLAN using Linuxbridge technology.

%package metadata-agent
Summary:        Neutron metadata Agent
Requires:       haproxy
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description metadata-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron metadata Agent.

%package ovn-metadata-agent
Summary:        Neutron OVN metadata Agent
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description ovn-metadata-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron OVN metadata Agent.

%package ovn-migration-tool
Summary:        networking-ovn ML2/OVS to OVN migration tool
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description ovn-migration-tool

This package provides the necessary tools to update an existing ML2/OVS
OpenStack to OVN based backend.

%package metering-agent
Summary:        Neutron metering Agent
Requires:       iptables
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description metering-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron metering Agent.

%package macvtap-agent
Summary:        Neutron macvtap agent
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description macvtap-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron agent that implements
macvtap attachments for libvirt qemu/kvm instances.

%package openvswitch-agent
Summary:        Neutron openvswitch plugin
Requires:       conntrack-tools
Requires:       ipset
Requires:       iptables
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}
Requires:       openvswitch
Provides:       {{ py2name('neutron') }}-l2-agent = %{epoch}:%{version}-%{release}

%description openvswitch-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron plugin that implements virtual
networks using Open vSwitch.

%package rpc-server
Summary:        Neutron (RPC only) Server
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description rpc-server
Neutron is a virtual network service for Openstack.

This package contains an alternative Neutron server that handles AMQP RPC
workload only.

%package sriov-nic-agent
Summary:        Neutron SR-IOV NIC agent
Requires:       {{ py2name() }} = %{epoch}:%{version}-%{release}

%description sriov-nic-agent
Neutron is a virtual network service for Openstack.

This package contains the Neutron agent to support advanced features of
SR-IOV network cards.

%if 0%{?with_doc}
%package doc
Summary:        Documentation for OpenStack Networking Service
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinx-feature-classification') }}
BuildRequires:  {{ py3('tenacity') }}

%description doc
OpenStack Neutron documentaion.

This package contains the documentation
%endif

%prep
%autosetup -p1 -n {{ pypi_name }}-{{upstream_version}}
%py_req_cleanup

%build
%py3_build

%if 0%{?with_doc}
# generate html docs
PYTHONPATH=$PWD PBR_VERSION={{ upstream_version }} %sphinx_build --keep-going -b html doc/source doc/build/html
PYTHONPATH=$PWD PBR_VERSION={{ upstream_version }} %sphinx_build --keep-going -b man doc/source doc/build/man
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
rm -rf doc/build/man/.{doctrees,buildinfo}
%endif

# Generate configuration files
PYTHONPATH=. tools/generate_config_file_samples.sh
find etc -name *.sample | while read filename
do
    filedir=$(dirname $filename)
    file=$(basename $filename .sample)
    mv ${filename} ${filedir}/${file}
done

%install
%py3_install

# create directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log,cache}/{{ pypi_name }}

# Move rootwrap files to proper location
install -d -m 755 %{buildroot}%{_datarootdir}/{{ pypi_name }}/rootwrap
mv %{buildroot}%{_prefix}%{_sysconfdir}/{{ pypi_name }}/rootwrap.d/*.filters %{buildroot}%{_datarootdir}/{{ pypi_name }}/rootwrap

# Move config files to proper location
install -d -m 755 %{buildroot}%{_sysconfdir}/{{ pypi_name }}
mv %{buildroot}%{_prefix}%{_sysconfdir}/{{ pypi_name }}/* %{buildroot}%{_sysconfdir}/{{ pypi_name }}
install -p -D -m 640 etc/api-paste.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/api-paste.ini
install -p -D -m 640 etc/l3_agent.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/l3_agent.ini
install -p -D -m 640 etc/dhcp_agent.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/dhcp_agent.ini
install -p -D -m 640 etc/metadata_agent.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/metadata_agent.ini
install -p -D -m 640 etc/neutron_ovn_metadata_agent.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/ovn_metadata_agent.ini
install -d -m 755 %{buildroot}%{_sysconfdir}/{{ pypi_name }}.conf.d
install -D -m 640 %{SOURCE20} %{buildroot}/%{_sysconfdir}/{{ pypi_name }}/{{ pypi_name }}.conf.d/010-neutron.conf
install -D -m 440 %{SOURCE90} %{buildroot}/%{_sysconfdir}/{{ pypi_name }}/README.config


# The generated config files are not moved automatically by setup.py
install -d -m 755 %{buildroot}%{_sysconfdir}/{{ pypi_name }}/plugins/ml2

mv etc/{{ pypi_name }}.conf %{buildroot}%{_sysconfdir}/{{ pypi_name }}/{{ pypi_name }}.conf
for agent in dhcp l3 metadata metering
do
  mv etc/${agent}_agent.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/${agent}_agent.ini
done

for file in linuxbridge_agent ml2_conf openvswitch_agent sriov_agent
do
  mv etc/{{ pypi_name }}/plugins/ml2/${file}.ini %{buildroot}%{_sysconfdir}/{{ pypi_name }}/plugins/ml2/${file}.ini
done

# default core plugin (the plugin.ini link defines the used plugin. see .service file)
ln -s %{_sysconfdir}/neutron/plugins/ml2/ml2_conf.ini %{buildroot}/%{_sysconfdir}/neutron/plugin.ini

# install modules/modprobe/sysctl
install -D -m 644 %{SOURCE22} %{buildroot}%{_libexecdir}/modules-load.d/openstack-neutron-linuxbridge-agent.conf
install -D -m 644 %{SOURCE22} %{buildroot}%{_libexecdir}/modules-load.d/openstack-neutron-openvswitch-agent.conf

install -p -D -m 644 %{SOURCE23} %{buildroot}%{_sysctldir}/99-openstack-neutron-linuxbridge-agent.conf
install -p -D -m 644 %{SOURCE23} %{buildroot}%{_sysctldir}/99-openstack-neutron-openvswitch-agent.conf

# Install logrotate
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

# Install sudoers
install -p -D -m 440 %{SOURCE2} %{buildroot}%{_sysconfdir}/sudoers.d/%{name}

# Install systemd tmpfiles
install -D -m 644 %{SOURCE21} %{buildroot}/%_tmpfilesdir/%{name}.conf

# Install systemd units
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-neutron-server.service
ln -s openstack-neutron-server.service %{buildroot}%{_unitdir}/openstack-neutron.service
install -p -D -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/openstack-neutron-linuxbridge-agent.service
install -p -D -m 644 %{SOURCE5} %{buildroot}%{_unitdir}/openstack-neutron-openvswitch-agent.service
install -p -D -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/openstack-neutron-dhcp-agent.service
install -p -D -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/openstack-neutron-l3-agent.service
install -p -D -m 644 %{SOURCE8} %{buildroot}%{_unitdir}/openstack-neutron-metadata-agent.service
install -p -D -m 644 %{SOURCE9} %{buildroot}%{_unitdir}/openstack-neutron-macvtap-agent.service
install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/openstack-neutron-metering-agent.service
install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/openstack-neutron-sriov-nic-agent.service
install -p -D -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/openstack-neutron-rpc-server.service
install -p -D -m 644 %{SOURCE13} %{buildroot}%{_unitdir}/openstack-neutron-netns-cleanup.service
install -p -D -m 644 %{SOURCE14} %{buildroot}%{_unitdir}/openstack-neutron-linuxbridge-cleanup.service
install -p -D -m 644 %{SOURCE15} %{buildroot}%{_unitdir}/openstack-neutron-ovs-cleanup.service
install -p -D -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/openstack-neutron-ovn-metadata-agent.service

# Create config dirs for all services that can be populated by users with custom *.conf files
for service in server rpc-server ovs-cleanup netns-cleanup linuxbridge-cleanup macvtap-agent; do
    mkdir -p %{buildroot}/%{_sysconfdir}/{{ pypi_name }}/neutron-$service.conf.d
done
# Create config dirs for all agents that can be populated by users with custom *.conf files
for service in linuxbridge openvswitch dhcp l3 metadata metering ovn-metadata sriov-nic; do
    mkdir -p %{buildroot}/%{_sysconfdir}/{{ pypi_name }}/neutron-$service-agent.conf.d
done

%if 0%{?with_doc}
# man pages
mkdir -p %{buildroot}%{_mandir}/man1
install -p -D -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1/
%endif


%pre
%openstack_pre_user_group_create neutron neutron
exit 0

%check
# don't want to depend on hacking for package building
rm neutron/tests/unit/hacking/test_checks.py
%if 0%{?suse_version}
python3 -m stestr.cli --test-path neutron/tests/unit run
%else
# NOTE(jpena): Reduce the number of unit tests, we have issues when testing time goes > 1h
python3 -m stestr.cli --test-path neutron/tests/unit run --black-regex '(neutron.tests.unit.objects|neutron.tests.unit.plugins)'
%endif

%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%systemd_post openstack-neutron-netns-cleanup.service
%systemd_post openstack-neutron-linuxbridge-cleanup.service
%systemd_post openstack-neutron-ovs-cleanup.service

%preun
%systemd_preun openstack-neutron-netns-cleanup.service
%systemd_preun openstack-neutron-linuxbridge-cleanup.service
%systemd_preun openstack-neutron-ovs-cleanup.service

%postun
%systemd_postun openstack-neutron-netns-cleanup.service
%systemd_postun openstack-neutron-linuxbridge-cleanup.service
%systemd_postun openstack-neutron-ovs-cleanup.service

%post server
%systemd_post openstack-neutron-server.service

%preun server
%systemd_preun openstack-neutron-server.service

%postun server
%systemd_postun_with_restart openstack-neutron-server.service

%post dhcp-agent
%systemd_post openstack-neutron-dhcp-agent.service

%preun dhcp-agent
%systemd_preun openstack-neutron-dhcp-agent.service

%postun dhcp-agent
%systemd_postun_with_restart openstack-neutron-dhcp-agent.service

%post l3-agent
%systemd_post openstack-neutron-l3-agent.service

%preun l3-agent
%systemd_preun openstack-neutron-l3-agent.service

%postun l3-agent
%systemd_postun_with_restart openstack-neutron-l3-agent.service

%post linuxbridge-agent
%systemd_post openstack-neutron-linuxbridge-agent.service

%preun linuxbridge-agent
%systemd_preun openstack-neutron-linuxbridge-agent.service

%postun linuxbridge-agent
%systemd_postun_with_restart openstack-neutron-linuxbridge-agent.service

%post metadata-agent
%systemd_post openstack-neutron-metadata-agent.service

%preun metadata-agent
%systemd_preun openstack-neutron-metadata-agent.service

%postun metadata-agent
%systemd_postun_with_restart openstack-neutron-metadata-agent.service

%post ovn-metadata-agent
%systemd_post openstack-neutron-ovn-metadata-agent.service

%preun ovn-metadata-agent
%systemd_preun openstack-neutron-ovn-metadata-agent.service

%postun ovn-metadata-agent
%systemd_postun_with_restart openstack-neutron-ovn-metadata-agent.service

%post metering-agent
%systemd_post openstack-neutron-metering-agent.service

%preun metering-agent
%systemd_preun openstack-neutron-metering-agent.service

%postun metering-agent
%systemd_postun_with_restart openstack-neutron-metering-agent.service

%post macvtap-agent
%systemd_post openstack-neutron-macvtap-agent.service

%preun macvtap-agent
%systemd_preun openstack-neutron-macvtap-agent.service

%postun macvtap-agent
%systemd_postun_with_restart openstack-neutron-macvtap-agent.service

%post openvswitch-agent
%systemd_post openstack-neutron-openvswitch-agent.service

%preun openvswitch-agent
%systemd_preun openstack-neutron-openvswitch-agent.service

%postun openvswitch-agent
%systemd_postun_with_restart openstack-neutron-openvswitch-agent.service

%post rpc-server
%systemd_post openstack-neutron-rpc-server.service

%preun rpc-server
%systemd_preun openstack-neutron-rpc-server.service

%postun rpc-server
%systemd_postun_with_restart openstack-neutron-rpc-server.service

%post sriov-nic-agent
%systemd_post openstack-neutron-sriov-nic-agent.service

%preun sriov-nic-agent
%systemd_preun openstack-neutron-sriov-nic-agent.service

%postun sriov-nic-agent
%systemd_postun_with_restart openstack-neutron-sriov-nic-agent.service

%files
%license LICENSE
%{_bindir}/neutron-db-manage
%{_bindir}/neutron-debug
%{_bindir}/neutron-ipset-cleanup
%{_bindir}/neutron-keepalived-state-change
%{_bindir}/neutron-netns-cleanup
%{_bindir}/neutron-ovn-db-sync-util
%{_bindir}/neutron-ovn-migration-mtu
%{_bindir}/neutron-pd-notify
%{_bindir}/neutron-rootwrap
%{_bindir}/neutron-rootwrap-daemon
%{_bindir}/neutron-sanity-check
%{_bindir}/neutron-status
%{_bindir}/neutron-usage-audit
%{_unitdir}/openstack-neutron-netns-cleanup.service
%{_unitdir}/openstack-neutron-linuxbridge-cleanup.service
%{_unitdir}/openstack-neutron-ovs-cleanup.service
%_tmpfilesdir/%{name}.conf
%attr(-, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/api-paste.ini
%config(noreplace) %{_sysconfdir}/neutron/plugin.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/plugins/ml2/*.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/dhcp_agent.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/l3_agent.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/metadata_agent.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/ovn_metadata_agent.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/metering_agent.ini
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/rootwrap.conf
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/{{ pypi_name }}.conf
%{_sysconfdir}/{{ pypi_name }}/README.config
%dir %{_sysconfdir}/{{ pypi_name }}
%dir %{_sysconfdir}/{{ pypi_name }}/plugins
%dir %{_sysconfdir}/{{ pypi_name }}/plugins/ml2
%dir %{_sysconfdir}/{{ pypi_name }}/{{ pypi_name }}.conf.d
%config(noreplace) %attr(0640, root, {{ pypi_name }}) %{_sysconfdir}/{{ pypi_name }}/{{ pypi_name }}.conf.d/010-neutron.conf
%{_sysconfdir}/sudoers.d/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %{_datarootdir}/{{ pypi_name }}
%dir %{_datarootdir}/{{ pypi_name }}/rootwrap
%dir %attr(0755, neutron, neutron) %{_localstatedir}/lib/{{ pypi_name }}
%dir %attr(0750, neutron, neutron) %{_localstatedir}/log/{{ pypi_name }}
%dir %attr(0750, neutron, neutron) %{_localstatedir}/cache/{{ pypi_name }}
%{_datarootdir}/{{ pypi_name }}/rootwrap/debug.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/dhcp.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/dibbler.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/ebtables.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/ipset-firewall.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/iptables-firewall.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/l3.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/linuxbridge-plugin.filters
%{_datarootdir}/{{ pypi_name }}/rootwrap/privsep.filters
%if 0%{?with_doc}
%{_mandir}/man1/neutron.1.gz
%endif

%files -n python3-{{ pypi_name }}
%license LICENSE
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/{{ pypi_name }}-*.egg-info

%if 0%{?with_doc}
%files doc
%license LICENSE
%doc doc/build/html
%endif

%files server
%license LICENSE
%{_bindir}/neutron-api
%{_bindir}/neutron-server
%{_unitdir}/openstack-neutron-server.service
%{_unitdir}/openstack-neutron.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-server.conf.d

%files dhcp-agent
%license LICENSE
%{_bindir}/neutron-dhcp-agent
%{_unitdir}/openstack-neutron-dhcp-agent.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-dhcp-agent.conf.d

%files l3-agent
%license LICENSE
%{_bindir}/neutron-l3-agent
%{_unitdir}/openstack-neutron-l3-agent.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-l3-agent.conf.d

%files linuxbridge-agent
%license LICENSE
%{_bindir}/neutron-linuxbridge-agent
%{_bindir}/neutron-linuxbridge-cleanup
%{_unitdir}/openstack-neutron-linuxbridge-agent.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-linuxbridge-agent.conf.d
%{_libexecdir}/modules-load.d/openstack-neutron-linuxbridge-agent.conf
%{_sysctldir}/99-openstack-neutron-linuxbridge-agent.conf

%files metadata-agent
%license LICENSE
%{_bindir}/neutron-metadata-agent
%{_unitdir}/openstack-neutron-metadata-agent.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-metadata-agent.conf.d

%files ovn-metadata-agent
%license LICENSE
%{_bindir}/neutron-ovn-metadata-agent
%{_unitdir}/openstack-neutron-ovn-metadata-agent.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-ovn-metadata-agent.conf.d

%files ovn-migration-tool
%license LICENSE
%{_bindir}/neutron-ovn-migration-mtu
%{_bindir}/ovn_migration.sh
%dir %{_datadir}/ansible
%{_datadir}/ansible/neutron-ovn-migration/

%files metering-agent
%license LICENSE
%{_unitdir}/openstack-neutron-metering-agent.service
%{_bindir}/neutron-metering-agent
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-metering-agent.conf.d

%files openvswitch-agent
%license LICENSE
%{_bindir}/neutron-openvswitch-agent
%{_bindir}/neutron-ovs-cleanup
%{_unitdir}/openstack-neutron-openvswitch-agent.service
%{_datarootdir}/{{ pypi_name }}/rootwrap/openvswitch-plugin.filters
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-openvswitch-agent.conf.d
%{_libexecdir}/modules-load.d/openstack-neutron-openvswitch-agent.conf
%{_sysctldir}/99-openstack-neutron-openvswitch-agent.conf

%files macvtap-agent
%license LICENSE
%{_bindir}/neutron-macvtap-agent
%{_unitdir}/openstack-neutron-macvtap-agent.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-macvtap-agent.conf.d

%files rpc-server
%license LICENSE
%{_bindir}/neutron-rpc-server
%{_unitdir}/openstack-neutron-rpc-server.service
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-rpc-server.conf.d

%files sriov-nic-agent
%license LICENSE
%{_unitdir}/openstack-neutron-sriov-nic-agent.service
%{_bindir}/neutron-sriov-nic-agent
%dir %{_sysconfdir}/{{ pypi_name }}/neutron-sriov-nic-agent.conf.d

%changelog
